# Maintainer: @naveen521kk on Github, Naveen M K <naveen521kk@gmail.com>

_perlname=Mozilla-CA
_realname="${_perlname,,}"
pkgbase=mingw-w64-perl-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-perl-${_realname}")
pkgver=20250202
pkgrel=1
pkgdesc="Mozilla's CA cert bundle in PEM format (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://metacpan.org/dist/Mozilla-CA"
msys2_repository_url="https://github.com/libwww-perl/Mozilla-CA"
license=('spdx:MPL-2.0')
groups=("${MINGW_PACKAGE_PREFIX}-perl-modules")
depends=(
  "${MINGW_PACKAGE_PREFIX}-perl"
)
options=('!emptydirs')
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-make"
  "${MINGW_PACKAGE_PREFIX}-python"
)
source=(
  "https://cpan.metacpan.org/authors/id/L/LW/LWP/Mozilla-CA-${pkgver}.tar.gz"
  "patchmakefile.py"
)
sha512sums=('ada494e2ecc4a7a780e0b41fddfb3e4ccb2a628411232a7c29a8bd72dbe43173b907946f7621f30c41d7b19c68aa9df55346ca50710867fdef93b4bfcd91e96b'
            'd7ec5ba4a3d75f674f4028e8a53bc4177ab71a379bc63affebf910e1d5a0e491b6642318218b55ddc4d90e0125d61e4b97626782af57d44522bcb5543fb21cb2')

build() {
  cd "$srcdir/${_perlname}-${pkgver}"
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL
  export pkgdir=$pkgdir
  python $srcdir/patchmakefile.py
  mingw32-make
}

package() {
  cd "$srcdir/${_perlname}-${pkgver}"
  mingw32-make DESTDIR="${pkgdir}/" install
}
